@extends('layouts.fz')
@section('css')
    <link href="{{asset('assets/css/bootstrap.css')}}" rel="stylesheet" />
    <!-- FontAwesome Styles-->
    <link href="{{asset('assets/css/font-awesome.css')}}" rel="stylesheet" />
    <!-- Custom Styles-->
    <link href="{{asset('assets/css/custom-styles.css')}}" rel="stylesheet" />
    <!-- Google Fonts-->
    <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
    <link href="{{asset('assets/js/dataTables/dataTables.bootstrap.css')}}" rel="stylesheet" />
    @endsection

@section('head')
    <h3 class="page-header">

    </h3>
    <ol class="breadcrumb">
        <li><a href="#">主页</a></li>
        <li><a href="#">部门管理</a></li>
        <li class="active">部门列表</li>
    </ol>
@endsection
@section('contain')

        <div class="row">
            <div class="col-md-12">
                <!-- Advanced Tables -->
                <div class="panel panel-default">
                    <div class="panel-heading">
                        部门列表
                    </div>
                    <div class="panel-body">
                        <div class="">
                            <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                                <thead>
                                <tr>
                                    <th>部门编号</th>
                                    <th>部门名称</th>
                                    <th>部门类型</th>
                                    <th>操作</th>

                                </tr>
                                </thead>
                                <tbody>
                                @foreach($department as $arr)
                                <tr class="odd gradeX">
                                    <td>{{$arr->id}}</td>
                                    <td>{{$arr->department_name}}</td>
                                    <td>{{\App\Department::get_department_type($arr->department_type)}}</td>
                                    <td class="center">
                                        <a href="{{url('department_update')}}/{{$arr->id}}" class="btn btn-primary " role="button"><i class="fa fa-edit"> </i>修改</a>
                                        <button class="btn btn-danger" onclick="confirmBox('{{url("department_delete")}}/{{$arr->id}}')"><i class="fa fa-trash-o"> </i>删除</button>

                                    </td>
                                </tr>
                                    @endforeach


                                </tbody>
                            </table>
                        </div>

                    </div>
                </div>
                <!--End Advanced Tables -->
            </div>
        </div>

@endsection
@section('js')
    <script src="{{asset('assets/js/jquery-1.10.2.js')}}"></script>
    <!-- Bootstrap Js -->
    <script src="{{asset('assets/js/bootstrap.min.js')}}"></script>
    <!-- Metis Menu Js -->
    <script src="{{asset('assets/js/jquery.metisMenu.js')}}"></script>
    <!-- Custom Js -->

   <script src="{{asset('assets/js/dataTables/jquery.dataTables.js')}}"></script>
   <script src="{{asset('assets/js/dataTables/dataTables.bootstrap.js')}}"></script>
        <script>
            $(document).ready(function () {
                $('#dataTables-example').dataTable({
                    "oLanguage": {
                        "sProcessing": "正在获取数据，请稍后...",
                        "sLengthMenu": "显示 _MENU_ 条",
                        "sZeroRecords": "没有您要搜索的内容",
                        "sInfo": "从 _START_ 到  _END_ 条记录 总记录数为 _TOTAL_ 条",
                        "sInfoEmpty": "记录数为0",
                        "sInfoFiltered": "(全部记录数 _MAX_ 条)",
                        "sInfoPostFix": "",
                        "sSearch": "搜索",
                        "sUrl": "",
                        "oPaginate": {
                            "sFirst": "第一页",
                            "sPrevious": "上一页",
                            "sNext": "下一页",
                            "sLast": "最后一页"
                        }
                    }
                });
            });
            function confirmBox(url) {
                console.log(url);
                $('#confirmBoxOk').attr('href',url);
                $('#confirmBox').modal()
            }
        </script>
    <script src="{{asset('assets/js/custom-scripts.js')}}"></script>
    @endsection